package com.wandian.ui.skins
{
	import flash.display.Graphics;	

	import com.wandian.utils.ColorUtil;
	import com.wandian.utils.Const;

	public class ScrollBarSkin extends Skin
	{
		public function ScrollBarSkin()
		{
			super();
		}

		override public function updateDisplay(w:int, h:int,state:String,...args):void
		{
			var fillColors:Array=getStyle("trackColors");
			var borderColor:int=ColorUtil.adjustBrightness(getStyle("borderColor"), -20)
			var borderDarkColor:int=ColorUtil.adjustBrightness(borderColor, -30)

			var g:Graphics=this.graphics
			g.clear();

			//border
			Const.matrix.createGradientBox(w, h, Const.PI_2, 0, 0)
			g.beginGradientFill("linear", [borderColor, borderDarkColor], Const.fullAlpha, Const.fullRatio, Const.matrix)
			g.drawRect(0, 0, w, h)
			w-=2
			h-=2
			//fill
			Const.matrix.createGradientBox(w / 3 * 2, h - 2, 0, 1, 1)
			g.beginGradientFill("linear", fillColors, Const.fullAlpha, Const.fullRatio, Const.matrix)
			g.drawRect(1, 1, w, h);

		}

	}
}